/**
 * 
 */
package contegor.scire.structure;

import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;

import org.testng.Assert;

class ValidationEventHandlerTestImpl implements ValidationEventHandler {

  private List<ValidationEvent> events = null;

  @Override
  public boolean handleEvent(ValidationEvent event) {
    if (events == null)
      events = new LinkedList<ValidationEvent>();
    events.add(event);
    return false;
  }

  public void check() {
    if (events != null)
      for (ValidationEvent event: events)
        TestConceptCloud.logger.error(event.toString());
    Assert.assertNull(events, "The loaded xml has erros.");
  }
}